{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set menu = 'admin_operation_group_thread' %}

{% set script_controller = 'group/thread' %}
{% block main %}

  <form  class="form-inline well well-sm" action="" method="get" novalidate>

    <div class="form-group">
      <select class="form-control" name="status">
        {{ select_options(dict('groupstatus'), app.request.query.get('status'), '话题状态'|trans) }}
      </select>
    </div>
    
    <div class="form-group">
      <select class="form-control" name="threadType">
        {{ select_options(dict('threadProperty'), app.request.get('threadType'), '属性'|trans) }}
      </select>
    </div>

    <div class="form-group">
      <input class="form-control" type="text" placeholder="{{'所属小组'|trans}}" name="groupName" value="{{ app.request.get('groupName') }}">
    </div>

    <div class="form-group">
      <input class="form-control" type="text" placeholder="{{'话题名称关键词'|trans}}" name="title" value="{{ app.request.get('title') }}">
    </div>

    <div class="form-group">
      <input class="form-control" type="text" placeholder="{{'创建者'|trans}}" name="userName" value="{{ app.request.get('userName') }}">
    </div>
    
    <button class="btn btn-primary">{{'搜索'|trans}}</button>
  </form>
  {% if threadinfo %}
    <form method="post" id="thread-form">
      <div class="table-responsive">
        <table class="table table-striped table-hover" id="thread-table">
          <thead>
            <tr>
              <th nowrap="nowrap"><input type="checkbox"  data-role="batch-select"/> {{'编号'|trans}}</th>
              <th width="30%">{{'名称'|trans}}</th>
              <th nowrap="nowrap">{{'属性'|trans}}</th>
              <th nowrap="nowrap">{{'创建者'|trans}}</th>
              <th nowrap="nowrap">{{'所属小组'|trans}}</th>
              <th nowrap="nowrap">{{'回复数'|trans}}</th>
              <th nowrap="nowrap">{{'状态'|trans}}</th>
              <th width="100px" nowrap="nowrap">{{'操作'|trans}}</th>
            </tr>
          </thead>

          <tbody>
            {% for thread in threadinfo %}  
              {% include 'TopxiaAdminBundle:Group:thread-table-tr.html.twig' with {thread:thread} %}
            {% endfor %}
          </tbody>
        </table>
      </div>
      <div>  
        <label class="checkbox-inline">
          <input type="checkbox" data-role="batch-select">{{'全选'|trans}}
        </label>
        <input type="hidden" id="batchDeleteThread" value="{{path('admin_groupThread_batch_delete')}}">
        <button id="thread-delete-btn" data-submiting-text="{{'正在删除'|trans}}" type="button" class="btn btn-default btn-sm mlm">{{'删除话题'|trans}}</button>
      </div>
      <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
    </form>
  {% else %}
    <div class="empty">{{'暂无话题！'|trans}}</div>
  {% endif %}
  <div class="pull-right">
    {{ admin_macro.paginator(paginator) }}
  </div>
{% endblock %}